# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>

pkgbase=orbiton
pkgname=(orbiton orbiton-gtk3 orbiton-nano)
pkgver=2.65.6
pkgrel=1
pkgdesc='Fast and configuration-free text editor and IDE limited by VT100'
arch=(loong64 x86_64)
url='https://orbiton.zip'
license=(BSD)
makedepends=(git go vte3)
source=("git+https://github.com/xyproto/orbiton#commit=931973a9f00f8c3dbd6fff634384010fd675067d") # tag: v2.65.6
options=(!lto)
b2sums=('SKIP')

build() {
  CXXFLAGS="$CXXFLAGS -Wl,--as-needed,--strip-all,--sort-common,-z,relro,-z,now" make -C $pkgbase o gui
}

package_orbiton() {
  # TODO: consider moving one or more of these from AUR:
  # 'cxx: for compiling C and C++'
  # 'elm-bin: for compiling Elm'
  # 'guessica: for updating PKGBUILD files'
  # 'google-java-format: for formatting Java'
  # 'lua-format: for formatting Lua'
  # 'hare: for compiling Hare'
  # 'ktlint: for formatting Kotlin'
  # 'odin: for compiling Odin'
  # 'scala: for compiling Scala'
  # 'vlang: for compiling and formatting V'
  optdepends=('asciidoctor: for writing man pages'
              'agda: for compiling Agda'
              'astyle: for formatting C#'
              'autopep8: for formatting Python'
              'clang: for formatting C++ code with clang-format'
              'clojure: for compiling Clojure'
              'crystal: for compiling Crystal'
              'dart: for compiling and formatting Dart'
              'fpc: for compiling Object Pascal'
              'gdb: for debugging C'
              'gcc-d: for compiling D'
              'ghc: for compiling Haskell'
              'godot: for using GDScript'
              'haskell-brittany: for formatting Haskell'
              'jad: for decompiling .class files on the fly'
              'java-environment: for compiling Java'
              'just: for editing justfiles'
              'kotlin: for compiling Kotlin'
              'lua: for compiling Lua'
              'mlton: for compiling Standard ML'
              'mono: for compiling C#'
              'nasm: for compiling Assembly'
              'ocaml: for compiling and formatting OCaml'
              'perl-tidy: for formatting Perl'
              'pandoc: for exporting Markdown to PDF'
              'prettier: for formatting JavaScript, TypeScript and CSS'
              'rustup: for compiling and formatting Rust'
              'scdoc: for writing man pages'
              'shfmt: for formattig Shell scripts'
              'tidy: for formatting HTML'
              'yasm: for compiling Assembly'
              'zig: for compiling and formatting Zig')
  DESTDIR="$pkgdir" make -C $pkgbase install symlinks easteregg license
}

package_orbiton-gtk3() {
  pkgdesc='Fast and configuration-free text editor and IDE limited by VT100 (GTK3/VTE3)'
  depends=(orbiton vte3)
  DESTDIR="$pkgdir" PROJECT=$pkgname make -C $pkgbase gui-install gui-symlinks license
}

package_orbiton-nano() {
  pkgdesc='Fast and configuration-free text editor and IDE limited by VT100 (Nano/Pico Mode)'
  depends=(orbiton)
  conflicts=(nano)
  provides=(nano)
  install -d "$pkgdir/usr/bin"
  DESTDIR="$pkgdir" PROJECT=$pkgname make -C $pkgbase nano-symlink license
}
